﻿<UserControl x:Class="ContactTracing.CaseView.Controls.CaseActionsRowControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:p="clr-namespace:ContactTracing.CaseView.Properties"
             xmlns:controls="clr-namespace:ContactTracing.CaseView.Controls"
             xmlns:own="clr-namespace:ContactTracing.CaseView"
             mc:Ignorable="d" 
             Name="userControl"
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.Resources>
            <BooleanToVisibilityConverter x:Key="bvc"/>

            <Style TargetType="{x:Type Path}">
                <Setter Property="Fill" Value="{StaticResource TabUnderlineSelectedBrush}" />
                <Setter Property="Margin" Value="2, 0, 2, 0" />
                <Setter Property="VerticalAlignment" Value="Center" />
                <Setter Property="Stroke" Value="Transparent" />
                <Setter Property="Stretch" Value="Fill" />
                <Style.Triggers>
                    <DataTrigger
                        Binding="{Binding
                            RelativeSource={RelativeSource
                                Mode=FindAncestor,
                                AncestorType={x:Type DataGridCell}},
                                Path=IsSelected}"
                        Value="True">
                        <Setter Property="Fill" Value="White"/>
                    </DataTrigger>
                    
                    <Trigger Property="IsEnabled" Value="False">
                        <Setter Property="Fill" Value="#C8C8CA" />
                    </Trigger>

                </Style.Triggers>
            </Style>
        </Grid.Resources>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <Button 
            x:Name="btnActions" 
            Grid.Column="4" 
            Width="22" 
            Padding="0" 
            Margin="0" 
            BorderBrush="Transparent" 
            BorderThickness="0"
            Background="Transparent" 
            IsEnabled="{Binding IsLocked, Converter={StaticResource BooleanInverter}}"
            Click="btnActions_Click">
            <Button.ContextMenu>
                <ContextMenu>
                    <MenuItem x:Name="mnuDelete" Header="{x:Static p:Resources.DeleteCase}" Click="btnDelete_Click"
                              Visibility="{Binding ElementName=userControl, Path=ShowDeleteButton, Converter={StaticResource bvc}, FallbackValue=Visible}">
                        <MenuItem.Icon>
                            <Path x:Name="pathTrash"
                                  Fill="Black"
                                  
                  Width="13" 
                  Height="16" Data="F1 M 25.3333,23.75L 50.6667,23.75C 51.5411,23.75 51.8541,27.3125 51.8541,27.3125L 24.1458,27.3125C 24.1458,27.3125 24.4589,23.75 25.3333,23.75 Z M 35.625,19.7917L 40.375,19.7917C 40.8122,19.7917 41.9583,20.9378 41.9583,21.375C 41.9583,21.8122 40.8122,22.9584 40.375,22.9584L 35.625,22.9584C 35.1878,22.9584 34.0416,21.8122 34.0416,21.375C 34.0416,20.9378 35.1878,19.7917 35.625,19.7917 Z M 27.7083,28.5L 48.2916,28.5C 49.1661,28.5 49.875,29.2089 49.875,30.0834L 48.2916,53.8334C 48.2916,54.7078 47.5828,55.4167 46.7083,55.4167L 29.2917,55.4167C 28.4172,55.4167 27.7083,54.7078 27.7083,53.8334L 26.125,30.0834C 26.125,29.2089 26.8339,28.5 27.7083,28.5 Z M 30.0833,31.6667L 30.4792,52.25L 33.25,52.25L 32.8542,31.6667L 30.0833,31.6667 Z M 36.4167,31.6667L 36.4167,52.25L 39.5833,52.25L 39.5833,31.6667L 36.4167,31.6667 Z M 43.1458,31.6667L 42.75,52.25L 45.5208,52.25L 45.9167,31.6667L 43.1458,31.6667 Z ">
                            </Path>
                        </MenuItem.Icon>
                    </MenuItem>
                    <MenuItem Header="{x:Static p:Resources.Print}"
                              Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:CaseActionsRowControl}, Mode=FindAncestor}, Path=ShowPrintButton, Converter={StaticResource bvc}, FallbackValue=Visible}">
                        <MenuItem Header="{x:Static p:Resources.TooltipPrintCRF}" Click="mnuPrintCaseReportForm_Click"></MenuItem>
                        <MenuItem Header="{x:Static p:Resources.TooltipPrintOutcomeForm}" Click="mnuPrintOutcomeForm_Click"></MenuItem>

                        <MenuItem.Icon>
                            <Path x:Name="pathPrint"
                                  Fill="Black"
              Width="12" 
              Height="14" Data="F1 M 25,27L 25,17L 51,17L 51,27L 47,27L 47,21L 29,21L 29,27L 25,27 Z M 16,28L 60,28L 60,51L 52,51L 52,46L 55,46L 55,33L 21,33L 21,46L 24,46L 24,51L 16,51L 16,28 Z M 25,39L 28,39L 28,52L 35,52L 35,59L 48,59L 48,39L 51,39L 51,62L 33,62L 25,54L 25,39 Z M 46,55L 38,55L 38,52L 46,52L 46,55 Z M 46,49L 30,49L 30,46L 46,46L 46,49 Z M 46,43L 30,43L 30,40L 46,40L 46,43 Z ">
                            </Path>
                        </MenuItem.Icon>
                        
                    </MenuItem>

                    <MenuItem x:Name="mnuConvert" Header="{x:Static p:Resources.TooltipConvertToContactHeading}" Click="btnConvert_Click"
                              Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:CaseActionsRowControl}, Mode=FindAncestor}, Path=ShowConvertButton, Converter={StaticResource bvc}, FallbackValue=Visible}">
                        <MenuItem.Icon>
                            <Path x:Name="pathConvert"
                                  Fill="Black"
                                  
                  Width="12" 
              Height="14" Data="F1 M 21,23L 21,53L 26,53L 26,57L 17,57L 17,19L 26,19L 26,23L 21,23 Z M 27,47L 31,47L 31,53L 55,53L 55,35L 43,35L 43,23L 31,23L 31,41L 27,41L 27,19L 47.25,19L 59,30.75L 59,57L 27,57L 27,47 Z M 22,42L 40,42L 33,36L 39,36L 48.2918,44.3334L 39,52L 33,52L 40,46L 22,46L 22,42 Z M 47,24.25L 47,31L 53.75,31L 47,24.25 Z ">
                            </Path>
                        </MenuItem.Icon>
                    </MenuItem>
                    <MenuItem Header="{x:Static p:Resources.ShowLabRecords}" Click="btnLab_Click"
                              Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:CaseActionsRowControl}, Mode=FindAncestor}, Path=ShowLabButton, Converter={StaticResource bvc}, FallbackValue=Visible}">
                        <MenuItem.Icon>
                            <Path x:Name="pathLab"
                                Width="12" 
                                Stroke="Black"
                                StrokeThickness="1.5"
                                Fill="Transparent"
                                Height="14" 
                                Data="F1M48.285318,7.990675C54.81868,14.405607,53.832583,19.255089,53.903603,27.019871L54.127883,51.541206 22.30512,99.211171C14.604034,112.05055,19.813807,124.61242,32.445033,123.87062L105.48829,123.94443C119.14147,123.887,124.1265,111.23551,113.54582,97.904534L83.359525,51.659724 82.791399,27.099135C82.720381,19.334355,81.645742,14.503721,88.060673,7.9703587L48.285318,7.990675z">
                            </Path>
                        </MenuItem.Icon>
                    </MenuItem>

                    <MenuItem x:Name="mnuForceUnlock" Header="Force unlock on this record" Click="btnForceUnlock_Click"
                              Visibility="{Binding IsLocked,Converter={StaticResource bvc}, FallbackValue=Collapsed}">
                        <MenuItem.Icon>

                            <Path x:Name="pathForceUnlock"
                                  Fill="Black"
                                  Width="13" 
                                  Height="13" 
                                  Data="F1 M 52.2573,19.0027C 58.3793,19.0027 63.3422,23.9655 63.3422,30.0875L 63.3422,31.6711L 58.5915,31.6711L 58.5915,30.0875C 58.5915,26.5892 55.7556,23.7533 52.2573,23.7533C 48.759,23.7533 45.9231,26.5892 45.9231,30.0875L 45.923,34.8377L 49.0902,34.8377L 49.0902,55.4242L 19.0029,55.4242L 19.0029,34.8378L 41.1724,34.838L 41.1724,30.0875C 41.1724,23.9655 46.1353,19.0027 52.2573,19.0027 Z M 31.6711,50.6737L 36.4217,50.6737L 35.1052,44.0911C 35.8857,43.7018 36.4217,42.8956 36.4217,41.9642C 36.4217,40.6523 35.3583,39.5889 34.0464,39.5889C 32.7346,39.5889 31.6711,40.6523 31.6711,41.9642C 31.6711,42.8956 32.2072,43.7018 32.9876,44.0911L 31.6711,50.6737 Z"
                                  >
                            </Path>

                        </MenuItem.Icon>
                    </MenuItem>

                    

                </ContextMenu>
            </Button.ContextMenu>
            <Path 
                HorizontalAlignment="Center" 
                Width="16" Height="16" 
                Stretch="Fill" 
                Data="F1 M 27.5314,21.8628L 33.0126,19.4224L 34.7616,23.3507C 36.6693,22.9269 38.6044,22.8903 40.4668,23.2026L 42.0083,19.1868L 47.6098,21.337L 46.0683,25.3528C 47.6612,26.3669 49.0747,27.6889 50.2088,29.2803L 54.1371,27.5313L 56.5776,33.0126L 52.6493,34.7616C 53.0731,36.6693 53.1097,38.6043 52.7974,40.4668L 56.8131,42.0083L 54.6629,47.6097L 50.6472,46.0683C 49.6331,47.6613 48.3111,49.0748 46.7197,50.2089L 48.4686,54.1372L 42.9874,56.5776L 41.2384,52.6493C 39.3307,53.0731 37.3957,53.1097 35.5333,52.7974L 33.9918,56.8131L 28.3903,54.6629L 29.9318,50.6472C 28.3388,49.6331 26.9252,48.3111 25.7911,46.7196L 21.8628,48.4686L 19.4224,42.9873L 23.3507,41.2383C 22.9269,39.3307 22.8903,37.3957 23.2026,35.5332L 19.1869,33.9918L 21.3371,28.3903L 25.3528,29.9318C 26.3669,28.3388 27.6889,26.9252 29.2804,25.7911L 27.5314,21.8628 Z M 34.3394,29.7781C 29.7985,31.7998 27.7564,37.1198 29.7781,41.6606C 31.7998,46.2015 37.1198,48.2436 41.6606,46.2219C 46.2015,44.2002 48.2436,38.8802 46.2219,34.3394C 44.2002,29.7985 38.8802,27.7564 34.3394,29.7781 Z "
                />
        </Button>

    </Grid>
</UserControl>